 <template>
	<view class="container">
		<view class="list-cell b-b m-t" @click="jump" data-src="./means/means" hover-class="cell-hover" :hover-stay-time="50">
			<text class="cell-tit">个人资料</text>
			<text class="cell-more yticon icon-you"></text>
		</view>
		<view class="list-cell b-b" @click="navTo('/pagesA/address/address')" hover-class="cell-hover" :hover-stay-time="50">
			<text class="cell-tit">收货地址</text>
			<text class="cell-more yticon icon-you"></text>
		</view>
		<view class="list-cell" @click="navTo('/pagesA/set/bind/bind')" hover-class="cell-hover" :hover-stay-time="50">
			<text class="cell-tit">绑定手机号</text>
			<text class="cell-more yticon icon-you"></text>
		</view>
		
		<view class="list-cell m-t">
			<text class="cell-tit">消息推送</text>
			<switch checked color="#000" @change="switchChange" />
		</view>
		<view class="list-cell m-t b-b" @click="jumpsure" hover-class="cell-hover" :hover-stay-time="50">
			<text class="cell-tit">清除缓存</text>
			<text class="cell-more yticon icon-you"></text>
		</view>
		<view class="list-cell b-b" @click="navTo('关于Dcloud')" hover-class="cell-hover" :hover-stay-time="50">
			<text class="cell-tit" @click="guanyuwomen">关于我们</text>
			<text class="cell-more yticon icon-you"></text>
		</view>
		<view class="list-cell"  @click="checknew">
			<text class="cell-tit">检查更新</text>
			<text class="cell-tip">当前版本 1.0.3</text>
			<text class="cell-more yticon icon-you"></text>
		</view>
		<view class="list-cell log-out-btn" @click="toLogout">
			<text class="cell-tit">退出登录</text>
		</view>
	</view>
</template>

<script>
	import {  
	    mapMutations  
	} from 'vuex';
	export default {
		data() {
			return {
				user_id:'',
				res:[],
			};
		},
		onLoad() {
			uni.getStorage({
			key: 'user_id',
			success: (res) => {
				 this.user_id = res.data
				 this.setAjax()
				},
			});
		},
		methods:{
			...mapMutations(['logout']),
			setAjax() {},
			/**
			 * 统一跳转接口,拦截未登录路由
			 * navigator标签现在默认没有转场动画，所以用view
			 */
			navTo(url){
				uni.navigateTo({  
					url
				})  
			}, 
			jumpsure() {
				uni.showModal({
				title:'',
				content:'清除成功',
				showCancel: false,
				confirmColor:"#000",
					success() {
						return
					}
				})
			},
			guanyuwomen() {
				uni.showModal({
				title:'',
				content:'暂未开放',
				showCancel: false,
				confirmColor:"#000",
					success() {
						return
					}
				})
			},
			checknew(){
				uni.showModal({
				title:'',
				content:'已经是最新的版本啦',
				showCancel: false,
				confirmColor:"#000",
					success() {
						return
					}
				})
			},
			jump(e){
				uni.navigateTo({
					url: e.currentTarget.dataset.src
				});
			},
			//退出登录
			// toLogout(){
			// 	uni.showModal({
			// 		content: "是否退出登录",
			// 		confirmText: "确定",
			// 		cancelText: "取消",
			// 		success: res => {
			// 			if(res.confirm){
			// 				uni.clearStorageSync()
			// 				uni.reLaunch({
			// 					url: '../index/index'
			// 				});
			// 			}
			// 		}
			// 	})
			// },
			//switch
			switchChange(e){
				let statusTip = e.detail.value ? '打开': '关闭';
				this.$api.msg(`${statusTip}消息推送`);
			},

		}
	}
</script>

<style lang='scss'>
	page{
		background: $page-color-base;
	}
	.list-cell{
		display:flex;
		align-items:baseline;
		padding: 20upx $page-row-spacing;
		line-height:60upx;
		position:relative;
		background: #fff;
		justify-content: center;
		&.log-out-btn{
			margin-top: 40upx;
			.cell-tit{
				color: #000;
				text-align: center;
				margin-right: 0;
			}
		}
		&.cell-hover{
			background:#fafafa;
		}
		&.b-b:after{
			left: 30upx;
		}
		&.m-t{
			margin-top: 16upx; 
		}
		.cell-more{
			align-self: baseline;
			font-size:$font-lg;
			color:$font-color-light;
			margin-left:10upx;
		}
		.cell-tit{
			flex: 1;
			font-size: $font-base + 2upx;
			color: $font-color-dark;
			margin-right:10upx;
		}
		.cell-tip{
			font-size: $font-base;
			color: $font-color-light;
		}
		switch{
			transform: translateX(16upx) scale(.84);
		}
	}
</style>
